﻿<%@ WebService Language="C#" Class="Pontuacao" %>

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Web;
using System.Web.Services;

[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
// [System.Web.Script.Services.ScriptService]
public class Pontuacao : System.Web.Services.WebService 
{
    public Pontuacao()
    {
    }

    [WebMethod]
    public int obterPontuacaoCliente(String cpf)
    {
        return new SOA.DAL.Cliente().GetPontuacaoByCliente(cpf);
    }

    [WebMethod]
    public int calcularPontuacao(double valor)
    {
        var v = Convert.ToDecimal(valor * 10);
        return Convert.ToInt32(Decimal.Round(v,0));
    }

    [WebMethod]
    public bool creditar(String cpf, int numPontos)
    {
        return new SOA.DAL.Cliente().CreditarPontuacaoByCliente(cpf,numPontos);
    }

    [WebMethod]
    public bool debitar(String cpf, int numPontos)
    {
        return new SOA.DAL.Cliente().DebitarPontuacaoByCliente(cpf,numPontos);
    }
}
